package com.example.controller;

import com.example.entity.Order;
import com.example.service.OrderServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class OrderController {
    @Autowired
    private OrderServiceImpl orderService;
    @PostMapping("/create")
    public String createOrder(@RequestBody Order order){
        Boolean orderRes = orderService.createOrder(order);
        if(orderRes){
            Long id = order.getId();
            return "创建订单"+id+"成功";
        }else {
            return "创建订单失败";
        }
    }
}

